package net.zjitc.plugins;

import com.baomidou.mybatisplus.core.injector.AbstractMethod;
import com.baomidou.mybatisplus.core.injector.DefaultSqlInjector;
import com.baomidou.mybatisplus.core.metadata.TableInfo;
import com.baomidou.mybatisplus.extension.injector.methods.InsertBatchSomeColumn;

import java.util.List;

/**
 * @author 毛钰深
 * @create 2022/2/1
 *
 * SQL注入器,注入InsertBatchSomeColumn插件
 */
public class MySqlInjector extends DefaultSqlInjector {

    @Override
    public List<AbstractMethod> getMethodList(Class<?> mapperClass, TableInfo tableInfo) {
        List<AbstractMethod> methodList = super.getMethodList(mapperClass, tableInfo);
        //不要逻辑删除字段
        methodList.add(new InsertBatchSomeColumn(i -> !i.isLogicDelete()));
        methodList.add(new UpdateBatchSomeColumn());
        return methodList;
    }
}
